<template>
	<div class="app-container">
		<!--弹窗-->
		<el-dialog :title="recordDialog.title" width="800px" :close-on-click-modal="true"
				:visible.sync="recordDialog.visible" @close="handleClose()">
            <el-table :data="recordDialog.info" ref="record" stripe highlight-current-row border height="450">
                <el-table-column v-if="recordDialog.option==0" prop="key" label="Key"></el-table-column>
                <el-table-column prop="oldValue" label="Old Value" :show-overflow-tooltip="true">
                    <template slot-scope="scope">
                    	<span>{{scope.row.oldValue }}</span>
                    </template>
                </el-table-column>
                <el-table-column prop="newValue" label="New Value" :show-overflow-tooltip="true">
                    <template slot-scope="scope">
                    	<span>{{scope.row.newValue }}</span>
                    </template>
                </el-table-column>
                <!-- <el-table-column prop="creatorId" label="Operator"  width="120"></el-table-column> -->
                <el-table-column prop="createdDate" label="Record Date" width="160">
                    <template slot-scope="scope">
                    	{{scope.row.createdDate | dateFormat }}
                    </template>
                </el-table-column>
                <el-table-column v-if="recordDialog.role=='OWNER' || recordDialog.role=='PARTNER'" label="操作" align="center" width="100" >
                    <template slot-scope="scope">
                        <el-link icon="el-icon-refresh-left" type="primary" :underline="false" @click="handleRevoke(scope.row)">回退</el-link>
                    </template>
                </el-table-column>
            </el-table>
		</el-dialog>
	</div>
</template>

<script>
	export default {
		props: {
		  recordDialog: {}
		},
		methods: {
            handleRevoke(row) {
                let item = {};
                if (row.key=='yamlSource') {
                    item = {
                        yamlMode: true,
                        yamlSource: row.oldValue
                    }
                } else {
                    item = {
                        yamlMode: false,
                        key: row.key,
                        value: row.oldValue
                    }
                }
                this.$parent.handleModify(0, item);
                this.handleClose();
            },
			handleClose(form) {
				this.recordDialog.visible = false;
				this.recordDialog.info = [];
			}
		}
	}
</script>
<style scoped>
</style>
